package net.towee.client.event.core;

import java.util.List;

import net.towee.model.repo.NodeData;

import com.google.gwt.event.shared.GwtEvent;

public class NodesMovedEvent extends GwtEvent<NodesMovedHandler> {
	public static Type<NodesMovedHandler> TYPE = new Type<NodesMovedHandler>();
	private final List<NodeData> nodes;
	private final String oldParent;

	public NodesMovedEvent(String oldParentId, List<NodeData> movedNodes) {
		this.oldParent = oldParentId;
		this.nodes = movedNodes;
	}

	@Override
	public Type<NodesMovedHandler> getAssociatedType() {
		return TYPE;
	}

	@Override
	protected void dispatch(NodesMovedHandler handler) {
		handler.onNodesMoved(oldParent, nodes);
	}

}
